<?php
/*********************************************
*
* FileName: function.showNews.php 
* function: 显示新闻
* 
* @Author: 李晓军
* @Email:   [email]teacherli@163.com[/email]
* @Date:    2004-12-22
* 
* 使用说明:
* <{plugin_article_list type='xxx' length=x size=y listName='yyy'} >
* @param string type: 要显示新闻的类型 length
* @param int length: 每条新闻的长度
* @param int size:   要显示多少条新闻
* @param string listName: 模板循环section的名称
* 
*   模板中可用到的变量:
*   @param ID 新闻编号
*   @param title 新闻标题
*   @param addDate 添加时间
*   @param typeName 所属类别名称
*   @param fileName 链接地址
* 示例:
 * <table>
    <{plugin_article_list type="calling" length="10" size="20" listName="callingList"}>
    <{section name=loop loop=$callingList}> 
    <tr> 
      <td> <a href="news/<{$callingList[loop].fileName}>" target="_blank"><{$callingList[loop].title}></a></td>
    </tr>
    <{/section}>
</table>
* *******************************************/
/*
 * 文章列表插件
 * 
 * @since 1.0.0 2013-12-3 by sutroon
 */
function smarty_function_plugin_article_list($params,&$smarty){
    extract($params);
   $typeName=(null!=$typeName)?$typeName:'默认分类';
   $str=(null!=$str)?$str:'none';
   echo $str;
   $type = (null != $type) ? $type : "1"; //默认提取新闻类型为1
   $size = (null != $size) ? $size : 5; //默认显示新闻条数为5条
   $length = (null != $length) ? $length : 20; //默认每行显示20个汉字
   $listName = (null != $listName) ? $listName : "newsList"; //默认的section名称
   
   $strQuery = "SELECT a.*,c.Name as CatalogName from tGeneralArticle a left join tGeneralCatalog c on a.CatalogID=c.ID" .
                " WHERE c.Name='$typeName' " .
                "ORDER BY ID DESC ";
   
   /*
    $dm=new SoDataModule();
    $dataset=$dm->select_arrayset('tgeneralarticle', '');
    */
   
   $dataset=$smarty->dm->select_arrayset('tgeneralarticle', '');

   $smarty->assign($listName, $dataset);
   
   unset($newsList);
    
}
?>
